class Solution {
public:
    int climbStairs(int n) {
        if(n<3){
            return n;
        }
        vector<int> dict(n);
        dict[0]=1;
        dict[1]=2;
        for(int i=2;i<n;i++){
            dict[i]=dict[i-1]+dict[i-2];
        }
        return dict[n-1];
        /*
        if(n<3){
            return n;
        }
        int first=1;
        int second=2;
        int third=3;
        for(int i=2;i<n;i++){
            third=first+second;
            first=second;
            second=third;
        }
        return third;
        */
    }
};